package rlog

import (
	"github.com/wonderivan/logger"
	"log"
	"os"
)

// init 初始化
func init() {
	InitLog()
}

// InitLog 初始化log
func InitLog() {
	// 日志配置
	err := logger.SetLogger(`{"Console": {"level": "DEBG"}}`)

	// 通过配置文件配置
	var logConf string
	logConf = "/root/go/src/trace-source/log/conf/log.json"
	_, err = os.Stat(logConf)
	if err != nil {
		if !os.IsExist(err) {
			log.Printf("init log IsExist false:%v", err)
			logConf = "./conf/log.json"
		}
	}

	log.Print("init log succ")
	err = logger.SetLogger(logConf)
}
